ALGOL 68RS
   HOME

TheInfoList



OR:

ALGOL 68RS is the second
ALGOL 68 ALGOL 68 (short for ''Algorithmic Language 1968'') is an imperative programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and more rigorously d ...
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
written by I. F. Currie and J. D. Morrison, at the
Royal Signals and Radar Establishment The Royal Signals and Radar Establishment (RSRE) was a scientific research establishment within the Ministry of Defence (MoD) of the United Kingdom. It was located primarily at Malvern in Worcestershire, England. The RSRE motto was ''Ubique ...
(RSRE). Unlike the earlier
ALGOL 68-R ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published. On 20–24 July 1970 a working conference was arranged by the International Federation ...
, it was designed to be
portable Portable may refer to: General * Portable building, a manufactured structure that is built off site and moved in upon completion of site and utility work * Portable classroom, a temporary building installed on the grounds of a school to provide ...
, and implemented the language of the Revised Report. Versions of ALGOL 68RS were written for the
ICL 2900 Series The ICL 2900 Series was a range of mainframe computer systems announced by the British manufacturer ICL on 9 October 1974. The company had started development under the name "New Range" immediately on its formation in 1968. The range was not de ...
,
Multics Multics ("Multiplexed Information and Computing Service") is an influential early time-sharing operating system based on the concept of a single-level memory.Dennis M. Ritchie, "The Evolution of the Unix Time-sharing System", Communications of ...
, and
VAX VAX (an acronym for Virtual Address eXtension) is a series of computers featuring a 32-bit instruction set architecture (ISA) and virtual memory that was developed and sold by Digital Equipment Corporation (DEC) in the late 20th century. The V ...
running VMS. Subsequently, parts of this compiler were released into the
public domain The public domain (PD) consists of all the creative work to which no exclusive intellectual property rights apply. Those rights may have expired, been forfeited, expressly waived, or may be inapplicable. Because those rights have expired, ...
, as a
translator Translation is the communication of the meaning of a source-language text by means of an equivalent target-language text. The English language draws a terminological distinction (which does not exist in every language) between ''transl ...
from ALGOL 68 to C, as part of the public release of the
hardware description language In computer engineering, a hardware description language (HDL) is a specialized computer language used to describe the structure and behavior of electronic circuits, and most commonly, digital logic circuits. A hardware description language en ...
ELLA, also by the RSRE.


History

Although the
ALGOL 68-R ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published. On 20–24 July 1970 a working conference was arranged by the International Federation ...
compiler, written by I.F. Currie, J.D. Morrison, and S.G. Bond, was a great success, it suffered from two major problems: it had been written for the nearly obsolete ICL 1900 computer, and it implemented an out-of-date version of the language as it was released before the Revised Report on ALGOL 68 was available. RSRE needed a newer compiler for various internal projects, so the team of Currie and Morrison wrote a new compiler designed for
cross-platform In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software ...
software portability A computer program is said to be portable if there is very low effort required to make it run on different platforms. The pre-requirement for portability is the generalized abstraction between the application logic and system interfaces. When ...
between machines. The compiler dealt with the parsing of ALGOL 68, producing a high level intermediate language known as ''stream language'' that is then compiled to
machine code In computer programming, machine code is any low-level programming language, consisting of machine language instructions, which are used to control a computer's central processing unit (CPU). Each instruction causes the CPU to perform a ve ...
by a ''translator''. The compiler needed to know only the sizes of the various object machine data types and the
character encoding Character encoding is the process of assigning numbers to Graphics, graphical character (computing), characters, especially the written characters of Language, human language, allowing them to be Data storage, stored, Data communication, transmi ...
(set) available. The compiler was written in ALGOL 68, bootstrapped initially using the ALGOL 68-R compiler. A team of two programmers at
Oxford University Computing Services Oxford University Computing Services (OUCS) until 2012 provided the central Information Technology services for the University of Oxford. The service was based at 7-19 Banbury Road in central north Oxford, England, near the junction with Keble Ro ...
wrote a code generator for the ICL 2900 series.
Martyn Thomas Martyn Thomas CBE FREng FIET FRSA (born 1948) is a British independent consultant and software engineer. Overview Martyn Thomas founded the software engineering company Praxis in 1983, based in Bath, southern England. He has a special inte ...
of South West Universities Regional Computer Centre (SWURCC) arranged that this system be sponsored by International Computers Limited (ICL) and sold as an official ICL product. Later, the ''Avon Universities Joint Computer Centre'', a large user of
Multics Multics ("Multiplexed Information and Computing Service") is an influential early time-sharing operating system based on the concept of a single-level memory.Dennis M. Ritchie, "The Evolution of the Unix Time-sharing System", Communications of ...
requested the SWURCC team to produce a Multics version of ALGOL 68RS. A version for the
Digital Equipment Corporation Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president un ...
(DEC)
VAX VAX (an acronym for Virtual Address eXtension) is a series of computers featuring a 32-bit instruction set architecture (ISA) and virtual memory that was developed and sold by Digital Equipment Corporation (DEC) in the late 20th century. The V ...
computer was also written. Eventually the team at SWURCC formed a company,
Praxis Praxis may refer to: Philosophy and religion * Praxis (process), the process by which a theory, lesson, or skill is enacted, practised, embodied, or realised * Praxis model, a way of doing theology * Praxis (Byzantine Rite), the practice of fai ...
, initially supporting the Multics version of ALGOL 68RS. RSRE also used the ALGOL 68RS compiler for internal projects, including the
Flex machine The Flex Computer System was developed by Michael Foster and Ian Currie of Royal Signals and Radar Establishment (RSRE) in Malvern, England, during the late 1970s and 1980s. It used a tagged storage scheme to implement a capability architectu ...
and the ELLA hardware design language. When it was decided to make ELLA freely available, Praxis was commissioned to write an ALGOL 68 to C translator named ''ctrans'', based on the ALGOL 68RS compiler.


Restrictions in the language compiled

Like the earlier ALGOL 68-R compiler, ALGOL 68RS was a
one-pass compiler In computer programming, a one-pass compiler is a compiler that passes through the parts of each compilation unit only once, immediately translating each part into its final machine code. This is in contrast to a multi-pass compiler which conver ...
, which required some restrictions on the language compiled.


Declaration before use

The ALGOL 68 program: PROC even = (INT number) BOOL: ( number = 0 , TRUE , odd (ABS (number - 1))); PROC odd = (INT number) BOOL: ( number = 0 , FALSE , even (ABS (number - 1))); would have to be re-written as: PROC (INT) BOOL odd; PROC even = (INT number) BOOL : ( number = 0 , TRUE , odd (ABS (number - 1))); odd := (INT number) BOOL : ( number = 0 , FALSE , even (ABS (number - 1))); To allow recursive declarations of ''modes'' (types) a special ''stub'' mode declaration was used to inform the compiler that an upcoming symbol was a mode rather than an operator: MODE B, A = STRUCT (REF B b), B = :10REF A;


Parallel processing

Like ALGOL 68-R, the operators PAR clause and the SEMA mode with its associated UP, DOWN, and LEVEL, were omitted.


Extensions to ALGOL 68


Straightening

One major misfeature of ALGOL 68 is that it is impossible to write the standard ''transput'' (
input/output In computing, input/output (I/O, or informally io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Inputs are the signals ...
) procedures in pure ALGOL 68. The ''print'' procedure takes, for example, an array of items to print of any mode and, by a process named ''straightening'', converts them into simple values that can be printed. For example: STRUCT (INT a, REAL b) c := ...; print(c); The writers of ALGOL 68RS decided to make ''straightening'' available as part of the language. A STRAIGHT mode resembles an
array An array is a systematic arrangement of similar objects, usually in rows and columns. Things called an array include: {{TOC right Music * In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
but has the special feature that items can be
coerced Coercion () is compelling a party to act in an involuntary manner by the use of threats, including threats to use force against a party. It involves a set of forceful actions which violate the free will of an individual in order to induce a desi ...
to a STRAIGHT mode if their components can be coerced to the mode. For example: STRUCT (INT a, REAL b) c; STRAIGHT UNION (INT, REAL) z = c; Both the fields of C can be coerced to UNION (INT, REAL) so the field "a OF c" can be accessed as z and "b OF c" is z The standard ''print'' procedure can now be declared as: MODE PRINTMODE = UNION (INT, REAL, ... STRAIGHT PRINTMODE); PROC print = ([] PRINTMODE arguments ) VOID: ...;


Efficient array handling

The ALGOL 68 array modes are very powerful, including multiple dimensions, defined upper and lower bounds, trimming (making a new array by taking a contiguous subset of an array), slicing (making a new array by removing one dimension from an array), and rowing (making a new array by adding a dimension to an extant array. For example: :23, -7:7INT a; REF INT b = a 6:21, 0:3 REF [] INT c = a [5] While the compiler made all efforts to generate optimal code for all cases, it was felt that adding some simpler facilities would allow better code in some cases. To this end ALGOL 68RS included ''indexable structures'' (i-structs), ''vectors'', and the FORALL statement.


Indexable structures

ALGOL 68 already included fixed length structures to efficiently handle characters and bit-data on
word A word is a basic element of language that carries an objective or practical meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no conse ...
-based machines, the BYTES and BITS modes. A BYTES variable held one machine word of characters, a BITS variable held the bits of one machine word. ALGOL 68RS generalised these ideas. A STRUCT 4 CHAR variable held exactly 4 chars. The size was part of the type. On most ALGOL 68RS systems, the mode BYTES was equivalent to STRUCT 4 CHAR. MODE BYTES = STRUCT 4 CHAR; OP ELEM = (INT index, BYTES val) CHAR: val ndex ... BYTES b = "abcd"; ... print (2 ELEM b); The ALGOL 68RS compiler would compile any string constant to an appropriate STRUCT ''n'' CHAR. In contexts where a VECTOR or array was wanted, an i-struct could be widened to the appropriate VECTOR or array type.


Vectors

A VECTOR is a simplified array, with only one dimension and a lower bound fixed at 1. VECTOR INT a; In any context where an array was required a VECTOR could be converted to an array.


FORALL statement

The FORALL statement allows efficient stepping through the elements of an array. 2INT a := ...; FORALL xa IN a DO xa := xa * 2 OD ''xa'' will be a reference to each element of ''a'' in turn. FORALL can step through multiple arrays in parallel, and be controlled by a WHILE clause: 2INT a, b; ... FORALL xa IN a, xb IN b WHILE xa > xb DO f(xa, xb) OD


Separate compiling

ALGOL 68RS provided a mechanism to build
libraries A library is a collection of Document, materials, books or media that are accessible for use and not just for display purposes. A library provides physical (hard copies) or electronic media, digital access (soft copies) materials, and may be a ...
similar to the separate compiling facilities of
ALGOL 68-R ALGOL 68-R was the first implementation of the Algorithmic Language ALGOL 68. In December 1968, the report on the Algorithmic Language ALGOL 68 was published. On 20–24 July 1970 a working conference was arranged by the International Federation ...
and a mechanism to build programs in a
top-down Top-down may refer to: Arts and entertainment * " Top Down", a 2007 song by Swizz Beatz * "Top Down", a song by Lil Yachty from ''Lil Boat 3'' * "Top Down", a song by Fifth Harmony from ''Reflection'' Science * Top-down reading, is a part of ...
manner similar to those of
ALGOL 68C ALGOL 68C is an imperative computer programming language, a dialect of ALGOL 68, that was developed by Stephen R. Bourne and Michael Guy to program the Cambridge Algebra System (CAMAL). The initial compiler was written in the Princeton Syntax ...
.


Declaration modules

Libraries in ALGOL 68RS are written using ''declaration modules'' which consist of a sequence of MODE, variable, operator and procedure declarations followed by a ''keep list'' which defines which declarations are visible to other segments. The library user then adds a USE header that tells the compiler to make the symbols of one or more declaration libraries available to the program. For example, a graphics library might be written as: DECS graphlib USE some other library MODE GRAPHDATA = STRUCT ( ... ); MODE GRAPH = REF GRAPHDATA; PROC new graph = ( ... ) GRAPH : ...; PROC draw graph = (GRAPH g) VOID : ...; ... KEEP GRAPH, new graph, draw graph FINISH And a user program to use this library would look like: PROGRAM myprog USE graphlib BEGIN GRAPH g = new graph (...); ... draw graph (g); ... END FINISH


Nested modules

To support a top-down programming style, ALGOL 68RS provided the HERE and CONTEXT facilities. A program could be written with parts to be filled in later marked by a HERE tag followed by a ''keeplist'' of declarations to be made available. PROGRAM (pass1, pass2) compiler BEGIN STRING source := ...; TREE parsetree; ... HERE pass1 (source, parsetree); ... INSTRUCTIONS insts; HERE pass2 (parsetree, insts); ... END FINISH The code to be executed in the context of the HERE tags would be written as: PROGRAM pass1 implementation CONTEXT pass1 IN compiler BEGIN ... END FINISH HERE is similar to the ALGOL 68C ENVIRON and CONTEXT is equivalent to the ALGOL 68C USING.


Code and alien access

ALGOL 68RS was intended to be usable for low level
systems programming Systems programming, or system programming, is the activity of programming computer system software. The primary distinguishing characteristic of systems programming when compared to application programming is that application programming aims to pr ...
. To allow this, facilities were included for access to machine code and non-ALGOL 68RS objects. Code was inserted with the CODE construct: SOMEMODE CODE (''item1'', ''item2'', ...) "...''code''..." Where the ''item''s are ALGOL 68RS values to be made available to the code insertion and SOMEMODE is the mode returned. The mode can be omitted if the code returns no value. Access to non-ALGOL68 objects was available with the ALIEN insertion: SOMEMODE ''name'' = ALIEN "''external-name''" Any simple ALGOL 68RS object could be ''cast'' into a VECTOR of characters using the SPELL operator: STRUCT (INT a, REAL b) c = ...; print (("internal repr = ", SPELL c, newline)); A ''simple'' object is one that contains no arrays or VECTORs.


Availability

The ALGOL 68 to C translator written by Praxis for the ELLA system contains most of the ALGOL 68RS compiler. The notable exception is the code for handling FORMATs. , ALGOL 68RS is available from
SourceForge SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirroring ...
.


References

{{ALGOL programming RS History of computing in the United Kingdom